function myshowBox(n, t, i, r, u, f) {
    var s = n, l = t, e = i, h = r, a = u, v = f, y = function () {
        var n = 0, t = 0;
        return window.innerWidth ? n = window.innerWidth : document.body && document.body.clientWidth && (n = document.body.clientWidth), window.innerHeight ? t = window.innerHeight : document.body && document.body.clientHeight && (t = document.body.clientHeight), document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth && (t = document.documentElement.clientHeight, n = document.documentElement.clientWidth), n + "-" + t
    }, o, c;
    a == "true" ? (o = "<iframe class='iframe-myshowbox' id='myshowbox' src='" + l + "' frameborder='0' scrolling='no' width='" + e + "' height='" + h + "'><\/iframe>", c = navigator.userAgent, c.indexOf("MSIE 6.0") > -1 && setTimeout("window.parent['myshowbox'].location.reload();", 0)) : o = "<div class='div-myshowbox' style='width:" + e + "px; height:" + h + "px;'><\/div>";
    $("body").append("<div id='mshowbox' class='myshowbox'><div class='myshowbox-container " + v + "'><a class='btn-close' href='javascript:void(0)'><span><\/span><\/a><h3 class='title'>" + s + "<\/h3>" + o + "<\/div><\/div><div id='bgScreen'><\/div><iframe id='bgIFrame' src='about:blank'><\/iframe>");
    s == "" ? $(".myshowbox .title").hide() : $(".myshowbox .title").css("width", e - 20 + "px");
    $(".myshowbox-container").css("width", e);
    $(".myshowbox").css("margin", -$(".myshowbox").height() / 2 - 5 + "px 0 0 " + -$(".myshowbox").width() / 2 + "px");
    $("#bgScreen, #bgIFrame").css("height", "100%");
    $(".myshowbox-container .btn-close, #bgScreen").click("click", function () {
        $(".myshowbox, #bgScreen, #bgIFrame").hide().remove()
    })
}

function hexToBytes(n) {
    for (var i = [], t = 0; t < n.length; t += 2) i.push(parseInt(n.substr(t, 2), 16));
    return i
}

function bytesToHex(n) {
    for (var i = [], t = 0; t < n.length; t++) i.push((n[t] >>> 4).toString(16)), i.push((n[t] & 15).toString(16));
    return i.join("")
}

function vercError(n) {
    $(".btn-popup").show();
    $(".popup-operate-btn a.popup-loading").hide();
    $(".popup-error-msg").text(n)
}

function checkPhone(n) {
    var i = $(n), t = $.trim(i.val()), r = !/^\d{7,15}$/.test(t);
    return t.length === 0 ? (vercError("手机号码为空"), !1) : t.length < 7 || t.length > 15 ? (vercError("请输入7到15位手机号码"), !1) : t.length > 0 && r ? (vercError("手机号码格式错误"), !1) : !0
}

function checkPhoneCode(n) {
    var t = $(n), i = $.trim(t.val());
    return i.length === 0 ? (vercError("请输入短信验证码"), !1) : !0
}

function checkName(n) {
    var t = $(n), i = $.trim(t.val());
    return i.length === 0 ? (vercError("请输入用户名"), !1) : !0
}

function checkCurPwd(n) {
    var t = $(n), i = $.trim(t.val());
    return i.length === 0 ? (vercError("请输入密码"), !1) : !0
}

// function checkPassword(n) {
//     var i = $(n), t = $.trim(i.val()), r = !/^[A-Za-z0-9]+$/.test(t);
//     return t.length === 0 ? (vercError("请设置您的密码"), !1) : t.length < 6 || t.length > 18 ? (vercError("请输入6-18个字符"), !1) : t.length > 0 && r ? (vercError("限数字、英文字母6-18个字符"), !1) : !0
// }

function HideLoding() {
    $(".btn-popup").show();
    $(".popup-operate-btn a.popup-loading").hide()
}

function checkAgreement(n) {
    var t = $(n);
    return t.length > 0 && !$(n).is(":checked") ? (vercError("请勾选会员注册协议"), !1) : !0
}

var publickKey, encrypt;
(function (n) {
    n.getAntiForgeryToken = function (n, t) {
        var u, f, i, r;
        for (n = n && typeof n == typeof window ? n : window, t = t && typeof t == "string" ? "_" + t.toString() : "", u = "__RequestVerificationToken" + t, f = n.document.getElementsByTagName("input"), i = 0; i < f.length; i++) if (r = f[i], r.type === "hidden" && r.name === u) return {
            name: u,
            value: r.value
        }
    };
    n.appendAntiForgeryToken = function (t, i) {
        return t && typeof t != "string" && (t = n.param(t)), i = i ? i : n.getAntiForgeryToken(), t = t ? t + "&" : "", i ? t + encodeURIComponent(i.name) + "=" + encodeURIComponent(i.value) : t
    };
    n.postAntiForgery = function (t, i, r, u) {
        return n.post(t, n.appendAntiForgeryToken(i), r, u)
    };
    n.ajaxAntiForgery = function (t) {
        var i = t.token ? t.token : n.getAntiForgeryToken(t.tokenWindow, t.appPath);
        return t.data = n.appendAntiForgeryToken(t.data, i), n.ajax(t)
    }
})(jQuery), function () {
    var t = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"],
        r = function (n) {
            for (var t = [], i; n > 0;) i = n % 2, n = Math.floor(n / 2), t.push(i);
            return t.reverse(), t
        }, i = function (n) {
            for (var u, i = 0, r = 0, t = n.length - 1; t >= 0; --t) u = n[t], u == 1 && (i += Math.pow(2, r)), ++r;
            return i
        }, n = function (n, t) {
            for (var s = 8 - (n + 1) + (n - 1) * 6, h = t.length, c = s - h, i, f, r, e, u, o; --c >= 0;) t.unshift(0);
            for (i = [], f = n; --f >= 0;) i.push(1);
            for (i.push(0), r = 0, e = 8 - (n + 1); r < e; ++r) i.push(t[r]);
            for (u = 0; u < n - 1; ++u) for (i.push(1), i.push(0), o = 6; --o >= 0;) i.push(t[r++]);
            return i
        }, u = {
            encoder: function (u) {
                for (var o, s, y, c, v, p, l, a = [], e = [], f = 0, h = u.length; f < h; ++f) if (o = u.charCodeAt(f), s = r(o), o < 128) {
                    for (y = 8 - s.length; --y >= 0;) s.unshift(0);
                    e = e.concat(s)
                } else o >= 128 && o <= 2047 ? e = e.concat(n(2, s)) : o >= 2048 && o <= 65535 ? e = e.concat(n(3, s)) : o >= 65536 && o <= 2097151 ? e = e.concat(n(4, s)) : o >= 2097152 && o <= 67108863 ? e = e.concat(n(5, s)) : o >= 4e6 && o <= 2147483647 && (e = e.concat(n(6, s)));
                for (c = 0, f = 0, h = e.length; f < h; f += 6) {
                    for (v = f + 6 - h, v == 2 ? c = 2 : v == 4 && (c = 4), p = c; --p >= 0;) e.push(0);
                    a.push(i(e.slice(f, f + 6)))
                }
                for (l = "", f = 0, h = a.length; f < h; ++f) l += t[a[f]];
                for (f = 0, h = c / 2; f < h; ++f) l += "=";
                return l
            }, decoder: function (n) {
                var l = n.length, a = 0, f, w, c, b, v, y, p, o, e, u, h, s;
                for (n.charAt(l - 1) == "=" && (n.charAt(l - 2) == "=" ? (a = 4, n = n.substring(0, l - 2)) : (a = 2, n = n.substring(0, l - 1))), f = [], u = 0, h = n.length; u < h; ++u) for (w = n.charAt(u), c = 0, b = t.length; c < b; ++c) if (w == t[c]) {
                    if (v = r(c), y = v.length, 6 - y > 0) for (p = 6 - y; p > 0; --p) v.unshift(0);
                    f = f.concat(v);
                    break
                }
                for (a > 0 && (f = f.slice(0, f.length - a)), o = [], e = [], u = 0, h = f.length; u < h;) if (f[u] == 0) o = o.concat(i(f.slice(u, u + 8))), u += 8; else {
                    for (s = 0; u < h;) {
                        if (f[u] == 1) ++s; else break;
                        ++u
                    }
                    for (e = e.concat(f.slice(u + 1, u + 8 - s)), u += 8 - s; s > 1;) e = e.concat(f.slice(u + 2, u + 8)), u += 8, --s;
                    o = o.concat(i(e));
                    e = []
                }
                return o
            }
        };
    window.BASE64 = u
}();
publickKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHwHOMa1hnnxI2Kd/S+X6hS537R7bMYjLn8j++jUTPL+2+3qne7+Ca7tts7+rGuYAdOGL6adRRp/k89N1D55w5V704zkm93jhkIV3qTrqhQUfQ+McpKHVzbwO3HhiuiTnoJiPqUBsx5VSth7gv3fvML2MRTHiP+2AA8+dDdOIoRwIDAQAB";
JSEncrypt.prototype.encryptLong = function (n) {
    var e = this.getKey(), u, h, i, s, f, r, c, l, a, v, y;
    try {
        var o = "", t = [];
        for (t.push(0), u = 0, h = n.length, s = 0, f = 0; f < h; f++) i = n.charCodeAt(f), u += i >= 65536 && i <= 1114111 ? 4 : i >= 2048 && i <= 65535 ? 3 : i >= 128 && i <= 2047 ? 2 : 1, (u % 117 >= 114 || u % 117 == 0) && u - s >= 114 && (t.push(f), s = u);
        if (t.length > 1) {
            for (r = 0; r < t.length - 1; r++) c = r == 0 ? n.substring(0, t[r + 1] + 1) : n.substring(t[r] + 1, t[r + 1] + 1), l = e.encrypt(c), o += l;
            return t[t.length - 1] != n.length - 1 && (a = n.substring(t[t.length - 1] + 1), o += e.encrypt(a)), hexToBytes(o)
        }
        return v = e.encrypt(n), y = hexToBytes(v), y
    } catch (p) {
        return console.log("--------ex--------"), console.log(p), !1
    }
};
encrypt = new JSEncrypt;
encrypt.setPublicKey(publickKey);
$(function () {
    function i(t) {
        n === 0 ? (t.removeAttribute("disabled"), t.value = "重获验证码", n = 59, t.style.color = "#23b7b7", t.style.cursor = "") : (t.setAttribute("disabled", !0), t.style.color = "#999", t.style.cursor = "default", t.value = n + "s后重发", n--, setTimeout(function () {
            i(t)
        }, 1e3))
    }

    var t = new TencentCaptcha("2087226830", function (n) {
        if (n.ret === 0) {
            var r = {CellPhone: TencentCaptchaPhone, Type: TencentCaptchaType, Ticket: n.ticket, Randstr: n.randstr}, t;
            t = TencentCaptchaType === "login" ? document.getElementById("loginCodeBtn") : document.getElementById("registerCodeBtn");
            $.ajax({
                type: "post",
                url: LogOrRegUrl.SendMessage,
                data: r,
                dataType: "json",
                cache: !1,
                success: function (n) {
                    if (n === undefined || n === null) return alert("访问频率过高，请稍后再试！"), !1;
                    if (!n.Success) return vercError(n.Message), !1;
                    i(t)
                }
            })
        }
    }, {bizState: ""}), n = 59, r;
    $(document).on("click", ".poupp-logintab li", function () {
        var n = $(this).index();
        $(this).addClass("poupp-logincur").siblings().removeClass("poupp-logincur");
        $(".input-info").val("");
        $(".popup-error-msg").text("");
        $(".popup-loginbox > div").eq(n).removeClass("hide").siblings().addClass("hide");
        HideLoding()
    });
    $(document).on("click", "#registerNow", function () {
        $(".popup-registerinfo").removeClass("hide");
        $(".popup-logininfo").addClass("hide");
        $(".slide-verifybox").html("");
        $(".input-info").val("");
        $(".popup-error-msg").text("");
        HideLoding()
    });
    $(document).on("click", "#loginNow", function () {
        $(".popup-logininfo").removeClass("hide");
        $(".popup-registerinfo").addClass("hide");
        $(".slide-verifybox").html("");
        $(".input-info").val("");
        $(".popup-error-msg").text("");
        HideLoding()
    });
    $(document).on("click", "#loginCodeBtn", function () {
        if (!checkPhone("#loginPhone")) return $("#loginPhone").focus(), !1;
        $(".popup-error-msg").text("");
        window.TencentCaptchaPhone = $("#loginPhone").val();
        window.TencentCaptchaType = "login";
        t.show()
    });
    $(document).on("click", "#popupQuickLogin", function () {
        var t, n;
        if ($(".btn-popup").hide(), $(".popup-operate-btn a.popup-loading").show(), encrypt.setPublicKey(publickKey), checkPhone("#loginPhone")) if (checkPhoneCode("#loginCode")) {
            if (checkAgreement("#loginAgree")) return t = "phoneNumber=" + $("#loginPhone").val().trim() + "&code=" + $("#loginCode").val().trim(), console.log(t), n = encrypt.encryptLong(t), n = bytesToHex(n), console.log(n), $.ajax({
                type: "POST",
                url: LogOrRegUrl.FastLogin,
                data: {p: n},
                dateType: "json",
                success: function (n) {
                    return n.Success ? (n.Message === "True" ? window.location = LogOrRegUrl.FastReturnUrl : window.parent.location.href = LogOrRegUrl.ReturnUrl, !0) : (vercError(n.Message), !1)
                }
            }), !0
        } else $("#loginCode").focus(); else $("#loginPhone").focus()
    });
    r = new TencentCaptcha("2087226830", function (n) {
        if (n.ret === 0) {
            var i = "LoginName=" + TencentCaptchaName + "&LoginPassword=" + TencentCaptchaPwd + "&Ticket=" + n.ticket + "&Randstr=" + n.randstr,
                t = encrypt.encryptLong(i);
            t = bytesToHex(t);
            $.ajax({
                type: "post", url: LogOrRegUrl.Login, data: {p: t}, dateType: "json", success: function (n) {
                    return n === undefined || n === null ? (alert("访问频率过高，请稍后再试！"), !1) : n.Success ? n.Data && n.Data.IsWeakCipher ? ($(".tips-content").text(n.Data.Tips), $(".tips-confirm").prop("href", n.Data.ReturnUrl), $(".weak-password-tips").show(), !1) : (window.parent.location.href = LogOrRegUrl.ReturnUrl, !0) : (vercError(n.Message), !1)
                }
            })
        } else $(".btn-popup").show(), $(".popup-operate-btn a.popup-loading").hide()
    }, {bizState: ""});
    $(document).on("click", ".tips-cancel", function () {
        $(".weak-password-tips").hide();
        window.parent.location.href = LogOrRegUrl.ReturnUrl
    });
    $(document).on("click", "#popupCommonLogin", function () {
        if ($(".btn-popup").hide(), $(".popup-operate-btn a.popup-loading").show(), checkName("#loginName")) {
            if (!checkCurPwd("#loginPwd")) return $("#loginPwd").focus(), !1
        } else return $("#loginName").focus(), !1;
        var n = $("#loginName").val(), t = $("#loginPwd").val();
        window.TencentCaptchaName = n;
        window.TencentCaptchaPwd = t;
        r.show()
    });
    $(document).on("click", ".popup-close", function () {
        $("#LogOrRegView").html("");
        window.parent.postMessage("closeiframe", "*")
    });
    $(document).on("click", "#registerCodeBtn", function () {
        if (!checkPhone("#registerPhone")) return $("#registerPhone").focus(), !1;
        $(".popup-error-msg").text("");
        window.TencentCaptchaPhone = $("#registerPhone").val();
        window.TencentCaptchaType = "register";
        t.show()
    });
    $(document).on("click", "#popupRegister", function () {
        var t, n;
        if ($(".btn-popup").hide(), $(".popup-operate-btn a.popup-loading").show(), checkPhone("#registerPhone")) if (checkPhoneCode("#registerCode")) if (checkPassword("#registerPwd")) if (checkAgreement("#registerAgree")) t = "registerPhone=" + $("#registerPhone").val() + "&registerCode=" + $("#registerCode").val() + "&registerPwd=" + $("#registerPwd").val(), n = encrypt.encryptLong(t), n = bytesToHex(n), $.ajax({
            type: "POST",
            url: LogOrRegUrl.Register,
            data: {p: n},
            dateType: "json",
            success: function (n) {
                return n.Success ? (window.location = LogOrRegUrl.FastReturnUrl, !0) : (vercError(n.Message), !1)
            }
        }); else return !1; else return $("#registerPwd").focus(), !1; else return $("#registerCode").focus(), !1; else return $("#registerPhone").focus(), !1
    });
    $(document).on("click", "#FindPassword", function () {
        window.parent.location.href = LogOrRegUrl.FindPasswordUrl
    })
})